<?php


namespace app\admin\model;


class AreaModel extends Common
{
    const FIELD = ['id','pid','name'];

    /**
     * @var string
     */
    protected $name = 'area';

    protected $defaultSoftDelete = 0;

    protected $autoWriteTimestamp = true;

    /**
     * @param int $pid 上一级
     * @param int $type
     * @return array
     * @author ran
     * @date 2021-09-23 13:53
     * mailbox 466180170@qq.com
     */
    public function getShopAdminAreaListResource(int $pid, int $type):array
    {
        $where =['pid'=>$pid,'type'=>$type];
        $connect = $this->field(self::FIELD);
        return [
            'list' => $connect->where($where)->select(),
            'dataCount' => $connect->count()
        ];
    }

}